package com.shop.loan.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.AttachmentType;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.Search;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;


@Setter
@Getter
@Entity
@Table(name = "s_loan_order_contract")
@Erupt(name = "订单合同")
@ApiModel("订单合同")
public class LoanOrderContract extends BaseModel {

    @Column(name = "order_id")
    private Long orderId;

    @EruptField(
            views = @View(title = "合同名称"),
            edit = @Edit(title = "合同名称")
    )
    @ApiModelProperty(name = "name", value = "合同名称", dataType = "string", example = "1")
    private String name;
    @EruptField(
            views = @View(
                    title = "合同链接",
                    type = ViewType.ATTACHMENT),
            edit = @Edit(
                    title = "合同链接",
                    type = EditType.ATTACHMENT,
                    readonly = @Readonly,
                    attachmentType = @AttachmentType(
                            type = AttachmentType.Type.BASE
                    )
            )
    )
    @ApiModelProperty(name = "url", value = "合同链接", dataType = "string", example = "1")
    private String url;


    private Long contractId;

    @EruptField(
            views = @View(title = "类型"),
            edit = @Edit(
                    title = "类型",
                    type = EditType.CHOICE,
                    notNull = true,
                    search = @Search,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "借款合同", value = "1"),
                                    @VL(label = "贷款告知书", value = "2"),
                                    @VL(label = "融资担保咨询服务合同", value = "3"),
                                    @VL(label = "个人征信客户授权书", value = "4"),
                                    @VL(label = "委托担保申请", value = "5"),
                                    @VL(label = "债券转让通知书", value = "6"),
                                    @VL(label = "其他", value = "99"),
                            }
                    ))
    )
    private Integer type;

    @EruptField(
            views = @View(title = "合同文件本地路径", show = false),
            edit = @Edit(title = "合同文件本地路径")
    )
    private String contractLocalPath;
}
